﻿<?php


class SubjectApp extends BaseApp
{
    var $type = 'subject';
	
    function index()
    {

	    $TB_alonepage = &$this->_model('subject'); 	 
		
		$data = $TB_alonepage->show();
        $this->assign('lw_data', $data['data']);		
		$this->assign('lw_page', $data['page']);	
  		
	 	$categorydata = & $GLOBALS['SCup']->_get_category_data($this->type);
		
		if(!is_array($categorydata))
		{
		 $categorydata = (array)$categorydata;
		}		
		$categorylist = array();
		foreach($categorydata as $value)
		{
		    $categorylist[$value['cat_id']] = $value['cat_name'];
		}	
		
        $this->assign('categorylist', $categorylist);							
	    
		
        $this->assign('view_charset', VIEW_CHARSET);	
        $this->assign('page_title', $GLOBALS['Lang']->_get_lang_var(SITE_TITLE));
        $this->assign('page_description', $GLOBALS['Lang']->_get_lang_var(SITE_DESCRIPTION));
        $this->assign('page_keywords', $GLOBALS['Lang']->_get_lang_var(SITE_KEYWORDS));	
		
        $this->assign('site_url',SITE_URL);
		
        $this->assign('web_view_dir',SITE_URL.'/admin/view/default/');
		
        $this->display('subject_list.view.php');
    }

    function add()
    {	
	    $time = time();
		
		$data = array();
		
		$data['filename'] = $time.'.html' ;
        $this->assign('data', $data);	
    		
	 	$categorydata = & $GLOBALS['SCup']->_get_category_data($this->type);
		   
        $this->assign('categorydata', $categorydata);	
		
        $this->assign('view_charset', VIEW_CHARSET);	
        $this->assign('page_title', $GLOBALS['Lang']->_get_lang_var(SITE_TITLE));
        $this->assign('page_description', $GLOBALS['Lang']->_get_lang_var(SITE_DESCRIPTION));
        $this->assign('page_keywords', $GLOBALS['Lang']->_get_lang_var(SITE_KEYWORDS));	
		
        $this->assign('site_url',SITE_URL);
        $this->assign('id','');				
        $this->assign('web_view_dir',SITE_URL.'/admin/view/default/');
		
        $this->display('subject_add.view.php');	

    }
	
	
    function addpost()
    {

	     $data = $_POST['data'];
       

         if(!isset($data['cat_id'])||empty($data['cat_id']))
		{
		 $notice = &get_message(array('msg'=>"所属栏目不能为空!",'url'=>'','title'=>'Notice'));
		 $notice ->display();		 
		 }	

         if(!isset($data['name'])||empty($data['name']))
		{
		 $notice = &get_message(array('msg'=>"专题名称不能为空!",'url'=>'','title'=>'Notice'));
		 $notice ->display();		 
		 }	

		 $data['user_id'] = $GLOBALS['SCup']->SCup_user_msg['user_id'];
		 $data['user_name'] = $GLOBALS['SCup']->SCup_user_msg['data']['user_name'];		 		 
	     $data['filepath'] = '?app=subject&pa='.$data['filename'] ;		 
	 
		 $TB_alonepage = &$this->_model('subject'); 	 
		
		 $TB_alonepage->post($data);
	 
         $this->index();

    }

    function edit()
    {	
		$id = $_GET['id'];
		 $TB_alonepage = &$this->_model('subject'); 	 
		
		$data = $TB_alonepage->oneshow($id);
	 	$categorydata = & $GLOBALS['SCup']->_get_category_data($this->type);
		   
        $this->assign('categorydata', $categorydata);

	    $this->assign('data', $data);		
			
	    $this->assign('nav_lang', get_all_dirname(ROOT_PATH . '/languages'));	
	    
        $this->assign('view_charset', VIEW_CHARSET);	
        $this->assign('page_title', $GLOBALS['Lang']->_get_lang_var(SITE_TITLE));
        $this->assign('page_description', $GLOBALS['Lang']->_get_lang_var(SITE_DESCRIPTION));
        $this->assign('page_keywords', $GLOBALS['Lang']->_get_lang_var(SITE_KEYWORDS));	
		
        $this->assign('site_url',SITE_URL);
		
        $this->assign('web_view_dir',SITE_URL.'/admin/view/default/');
		
        $this->display('subject_edit.view.php');
    }





    function editpost()
    {

	     $data = $_POST['data'];

         if(!isset($data['cat_id'])||empty($data['cat_id']))
		{
		 $notice = &get_message(array('msg'=>"所属栏目不能为空!",'url'=>'','title'=>'Notice'));
		 $notice ->display();		 
		 }	


         if(!isset($data['name'])||empty($data['name']))
		{
		 $notice = &get_message(array('msg'=>"专题名称不能为空!",'url'=>'','title'=>'Notice'));
		 $notice ->display();		 
		 }

		 $data['user_id'] = $GLOBALS['SCup']->SCup_user_msg['user_id'];
		 $data['user_name'] = $GLOBALS['SCup']->SCup_user_msg['data']['user_name'];			 		 
	     $data['filepath'] = '?app=subject&pa='.$data['filename'] ;
		 
		 $id = intval($data['id']);	 
		 

		 

		 $TB_alonepage = &$this->_model('subject'); 	 	 
		
		 $TB_alonepage->editaction($id,$data);
		 

		 $this->index();
		 

    }



    function del()
    {

	     $id = $_GET['id'];
		 $TB_alonepage = &$this->_model('subject'); 	 
		
		 $TB_alonepage->del($id); 
			 

		 $this->index();	  

    }

    function addcontent()
    {	
		$id = $_GET['id'];
		$aid = $_GET['aid'];		
		$do = $_GET['do'];
		$job = $_GET['job'];
		$action = $_GET['action'];		
		$TB_alonepage = &$this->_model('subject'); 	 
		
		$data = $TB_alonepage->oneshow($id);	
	
        if ($job =='showiframe') {
		
		
	if($action=="add"&&$aid)
	{
		unset($_detail);
		$detail=explode(",",$data['idlist']);
		if(!in_array($aid,$detail)){
			if($detail[0]==''){unset($detail[0]);}
			$_detail['a']=$aid;
			$data['idlist']=$string=implode(",",array_merge($_detail,$detail));
		    $db = & get_db();			
		    $db->query("UPDATE ".DB_PREFIX."subject SET idlist='$string' WHERE id='$id'");
		}
	}
	if($action=="del"&&$aid)
	{
		$detail=explode(",",$data['idlist']);
		foreach( $detail AS $key=>$value){
			if($value==$aid){
				unset($detail[$key]);
			}
		}
		$data['idlist']=$string=implode(",",$detail);
		$db = & get_db();
		$db->query("UPDATE ".DB_PREFIX."subject SET idlist='$string' WHERE id='$id'");
	}		
		
		
	//列出本专题下的文章,$type=='all',初始化时.$type=="list_atc",增加文章或移除文章时
	if($do=="list_atc"||$do=='all')
	{
        $module_list_data = & $GLOBALS['SCup']->_get_module_list_data();
        $appidname = array();
		$appname = '';
		
		unset($_listdb,$show);
		$detail=explode(",",$data['idlist']);
		$table_id = array();
		$$checkdata = array();		
		foreach( $detail AS $key=>$value){
		    $detail1=explode("_",$value);
			if (isset($detail1[0]) && isset($detail1[1])) {
			    $table_id[$detail1[0]] .= $detail1[1].","; 
			}
		}
		$db = & get_db();
		foreach ($table_id as $key => $value) {
		    $string = $value.'0';
		    $checkdata[$key] = $db->get_all("SELECT * FROM ".DB_PREFIX."content_".$key." WHERE id IN ($string)"); 
		} 
		$NUM=0;
		foreach($checkdata AS $key=>$value){
		    foreach($value as $key1=>$value1) {
			  $NUM++;
			  if($value1['id']){
			  
                foreach($module_list_data as $key2 => $value2) {
		            if($value2['id'] == $key) {
			            $appname = $key2;
				        break;
			        }
		        }			  
			  
				$show.="<tr align='center' class='trA' onmouseover=\"this.className='trB'\" onmouseout=\"this.className='trA'\"> 
                <td width='5%' style='border-bottom:1px dotted #ccc;'><a href='".SITE_URL.'/?app='.$appname.'&act=show&id='.$value1['id']."' target=_blank>".$value1['id']."</a></td>
                <td width='74%' style='border-bottom:1px dotted #ccc;' align='left'>".$value1['keywords']."</td>
                <td width='11%' style='border-bottom:1px dotted #ccc;'><A HREF='index.php?app=subject&act=addcontent&job=showiframe&id=$id&do=list_atc&action=del&aid=".$key."_".$value1['id']."' target='spiframe'>移除</A></td>
              </tr>";
			  }			
			
			}
		}		
		unset($module_list_data);		
		$show="<table width='100%' border='0' cellspacing='1' cellpadding='3'>
              <tr align='center'> 
                <td width='5%' bgcolor='#eeeeee'>ID</td>
                <td width='74%' bgcolor='#eeeeee'>关键字</td>
                <td width='11%' bgcolor='#eeeeee'>移除 </td>
				  $show
              </tr>
			  
            </table>";
		$show=str_replace("\r","",$show);
		$show=str_replace("\n","",$show);
		$show=str_replace('"','\"',$show);
		echo "<SCRIPT LANGUAGE='JavaScript'>
		<!--
		parent.document.getElementById('sp_atclist').innerHTML=\"$show\";
		//-->
		</SCRIPT>";
	}
			
		
		
		
	//$type=='all',初始化时,$type=='myatc'筛选时
	if($do=='myatc'||$do=='all')
	{

        if(!isset($_GET['word']))
		{
		$_GET['word'] = '';
		}					
        if(!isset($_POST['word']))
		{
		$_POST['word'] = '';
		}
		if($_GET['word'])
		{
	    $word = $_GET['word'];		
		}
		if($_POST['word'])
		{
	    $word = $_POST['word'];		
		}		
		
		
        if(!isset($_GET['tablecatid']))
		{
		$_GET['tablecatid'] = '';
		}					
        if(!isset($_POST['tablecatid']))
		{
		$_POST['tablecatid'] = '';
		}		
		if($_GET['tablecatid'])
		{
	    $tablecatid = $_GET['tablecatid'];		
		}
		if($_POST['tablecatid'])
		{
	    $tablecatid = $_POST['tablecatid'];		
		}	
		
  		$tablecatid =explode("_",$tablecatid);
      	if (isset($tablecatid[0])) {
		   $tableid = $tablecatid[0];
		}
      	if (isset($tablecatid[1])) {
		   $catid = $tablecatid[1];
		}		
        if(empty($tableid)) {
            $tableid = 1;
        }
        $module_list_data = & $GLOBALS['SCup']->_get_module_list_data();
        $appidname = array();
		$appname = '';
        foreach($module_list_data as $key => $value) {
		    if($value['id'] == $tableid) {
			    $appname = $key;
				break;
			}
		}
		unset($module_list_data);
		$word_array = explode(' ',$word);
		
		foreach($word_array as $key => $value)
		{
			if(!$value)
			{
             unset($word_array[$key]);
		    }  
		}		

		$condition='';
		$detail=explode(",",$data['idlist']);
		$show='';
		

		if($ismy){//只列出我的文章
			$condition=" user_id='".$GLOBALS['SCup']->SCup_user_msg['user_id']."' ";
		}else{
			$condition=' 1 ';
		}
		
        $order = 'add_time desc';
        $v=''; 		
		$temp_condition = '';
		$TB_new = &$this->_model('content');
	
		$data = $TB_new->subjectshow($order,$v,$word_array,$tableid,$this->type,$catid,$condition,$word,$temp_condition,'addcontent',$do,$job,$id);	
		$showpage = '';
		$pagelist ='';
		if (isset($data['page']['plist'])) {
            foreach ($data['page']['plist'] as $key =>$value) {
		        $pagelist .="<a href='".$value."' target=spiframe >".$key."</a>"; 
		    }		
		}
		$showpage ="<a href='".$data['page']['head']."' target=spiframe >首页</a>&nbsp;<a href='".$data['page']['up'].
		"' target=spiframe >上一页</a>&nbsp;".$pagelist."&nbsp;<a href='".$data['page']['down']."' target=spiframe >下一页</a>&nbsp;<a href='".$data['page']['foot']."' target=spiframe >尾页</a>&nbsp;共有".$data['page']['total']."条/".$data['page']['totalpage']."页";

		foreach( $data['data'] as $key =>$value) {
		     $add="&nbsp;";
			 if(!in_array($tableid.'_'.$value['id'],$detail)){
				$add="<A HREF='index.php?app=subject&act=addcontent&job=showiframe&id=$id&do=list_atc&action=add&aid=".$tableid.'_'.$value['id']."' target='spiframe' onclick=closedo(this)>添加</A>";
			 }
			$show.="<tr align='center' class='trA' onmouseover=\"this.className='trB'\" onmouseout=\"this.className='trA'\"> 
                <td width='5%' style='border-bottom:1px dotted #ccc;'>".$value['id']."</td>
                <td width='84%' style='border-bottom:1px dotted #ccc;' align='left'><A HREF='".SITE_URL.'/?app='.$appname.'&act=show&id='.$value['id']."' target=_blank>".$value['keywords']."</A></td>
                <td width='11%' style='border-bottom:1px dotted #ccc;'>&nbsp;$add</td>
              </tr>";			 
		}
		$show="<table width='100%' border='0' cellspacing='1' cellpadding='3'>
              <tr align='center'> 
                <td width='5%' bgcolor='#eeeeee'>ID</td>
                <td width='84%' bgcolor='#eeeeee'>关键字</td>
                <td width='11%' bgcolor='#eeeeee'>添加</td>
				  $show
              </tr>
			  
            </table>";
		$show=str_replace("\r","",$show);
		$show=str_replace("\n","",$show);
		$show=str_replace('"','\"',$show);
		echo "<SCRIPT LANGUAGE='JavaScript'>
		<!--
		parent.document.getElementById('show_myatc').innerHTML=\"$show\";
		//-->
		</SCRIPT>";		
		$showpage=str_replace("\r","",$showpage);
		$showpage=str_replace("\n","",$showpage);
		$showpage=str_replace('"',"",$showpage);
		echo "<SCRIPT LANGUAGE='JavaScript'>
		<!--
		parent.document.getElementById('show_myatc_page').innerHTML=\"$showpage\";
		//-->
		</SCRIPT>";

	}		


		
        }		
		
        $module_list_data = & $GLOBALS['SCup']->_get_module_list_data();
        $module_cat_data = array();
		foreach($module_list_data as $key => $value)
		{
		   $module_cat_data[$key]['alias']= $value['alias'];
		   $module_cat_data[$key]['id']= $value['id'] ;
		   $module_cat_data[$key]['appname']= $value['appname'] ;
		   $module_cat_data[$key]['catdata'] = $GLOBALS['SCup']->_get_category_data($value['appname']);
		}
        $this->assign('module_cat_data', $module_cat_data);	
	 	$categorydata = & $GLOBALS['SCup']->_get_category_data($this->type);
		   
        $this->assign('categorydata', $categorydata);
        $this->assign('data', $data);		
		
        $this->assign('view_charset', VIEW_CHARSET);	
        $this->assign('page_title', $GLOBALS['Lang']->_get_lang_var(SITE_TITLE));
        $this->assign('page_description', $GLOBALS['Lang']->_get_lang_var(SITE_DESCRIPTION));
        $this->assign('page_keywords', $GLOBALS['Lang']->_get_lang_var(SITE_KEYWORDS));	
		
        $this->assign('site_url',SITE_URL);
        $this->assign('id','');				
        $this->assign('web_view_dir',SITE_URL.'/admin/view/default/');
		
        $this->display('subject_addcontent.view.php');	

    }

    function kindeditor()
    {
    $w = intval($_GET['w']);
    include(ROOT_PATH."/data/ewebeditor/ewebeditor.lib.php");		
	
	$kindeditor = new Ewebeditor(array('imageUploadCgi'=>SITE_URL.'/admin/index.php?app=subject&act=kindeditorupfile&w='.$w));
	$kindeditor->show();
	
    }
	
    function kindeditorupfile()
    {
    $w = intval($_GET['w']);
    include(ROOT_PATH."/data/ewebeditor/ewebeditor.lib.php");	
	
	$kindeditor = new Ewebeditor(array('imageUploadCgi'=>SITE_URL.'/admin/index.php?app=subject&act=kindeditorupfile&w='.$w));
	$kindeditor->upfile('subject/'.$w);
	
    }

    function upfile()
    {
	 if(!isset($_POST["action"]))
	 {
	 $_POST["action"]='';
	 }
	 if(!isset($_GET['id']))
	 {
	 $_GET['id']='';
	 }
	 if(!isset($_GET["edit"]))
	 {
	 $_GET["edit"]='';
	 }	 
	 if(!isset($_GET["picurl"]))
	 {
	 $_GET["picurl"]='';
	 }	
	 if(!isset($_GET['jsfun']))
	 {
	 $_GET['jsfun']='';
	 }		 
	 if(!isset($_GET['putid']))
	 {
	 $_GET['putid']='';
	 }		 
	 if(!isset($_GET['uppic']))
	 {
	 $_GET['uppic']='';
	 }	
		$tf = $_GET['tf'];
        if(empty($tf))$tf = $_POST['tf'];	 	 	
		$action = $_POST["action"];		
		$id = intval($_GET['id']);		
		$jsfun = $_GET['jsfun'];
		$uppic = $_GET['putid'];
		if(!empty($_GET['uppic']))
		{
		$uppic = $_GET['uppic'];		
		}	
		$edit = $_GET["edit"];
		$picurl = $_GET["picurl"];

        $this->assign('jsfun', $jsfun);		


        $this->assign('uppic', $uppic);		
	
				

        $this->assign('edit', $edit);		


        $this->assign('picurl', $picurl);

        $this->assign('tf', $tf);
						
		if($action == 'post')
		{
			 if(!isset($_POST['jsfun']))
	 {
	 $_POST['jsfun']='';
	 }	
	 if(!isset($_POST['uppic']))
	 {
	 $_POST['uppic']='';
	 }		 
	 if(!isset($_POST["edit"]))
	 {
	 $_POST["edit"]='';
	 }		 
	 if(!isset($_POST["picurl"]))
	 {
	 $_POST["picurl"]='';
	 }	
	 if(!isset($_POST['id']))
	 {
	 $_POST['id']='';
	 }		 
		       $jsfun = $_POST['jsfun'];
		       $uppic = $_POST['uppic'];		
		       $edit = $_POST["edit"];
		       $picurl = $_POST["picurl"];
		 	   $id || $id = intval($_POST['id']);		
		       $filedname = trim(str_replace(array("UP_"),array(""),$uppic)); 
       
		       include(ROOT_PATH.'/lib/upfile.lib.php');	  
	           $upfile = new Upfile($this->type.'/'.$id); 	  
	           $updata = $upfile->_batch_upfile($this->type);		 
		 		 
		       $newfile = $updata[1]['path'];
	       
			   if($edit=='editp' && $picurl)
			   {

			          $TB_new = &$this->_model('content');			    		 		 		
		              $TB_new->editpicurl($id,array("$filedname"=>$newfile),$this->table_id);
		              $pic_dir= ROOT_PATH . '/' . UPFILE_PATH . '/' . $picurl;
			          if(!is_dir($pic_dir)&&file_exists($pic_dir))
		              {
		                del_file($pic_dir);	
		              }					  
				   
			   }

			    if($edit=='edit' && $picurl)
		       {
		              $pic_dir= ROOT_PATH . '/' . UPFILE_PATH . '/' . $picurl;
			          if(!is_dir($pic_dir)&&file_exists($pic_dir))
		              {
		                del_file($pic_dir);	
		              }				 
		       }
		
		      $pic_url = SITE_URL . '/' . UPFILE_PATH . '/' .$newfile;

              if($tf=='pic')
			  {
	           echo "<img src='{$pic_url}' id='upsrc' width='100px' height='100px'><br/><A HREF='?app=$this->type&act=upfile&edit=$edit&tf=$tf&picurl=$newfile&id=$id&jsfun=$jsfun&uppic=$uppic'>修改图片</A>";			  
			  }else
			  {
	           echo "<A HREF='?app=$this->type&act=upfile&edit=$edit&tf=$tf&picurl=$newfile&id=$id&jsfun=$jsfun&uppic=$uppic'>修改文件</A>";			  
			  }

	    echo "<script>
				if(self==top){
					window.opener.$jsfun('$newfile','$uppic');
					window.self.close();
				}else{
					window.parent.$jsfun('$newfile','$uppic');
				}
		     </script>";
				
	    exit;		
		
		}

        $this->assign('id', $id);
	    $this->assign('app', $this->type);		    
        $this->assign('view_charset', VIEW_CHARSET);	
        $this->assign('page_title', SITE_TITLE);
        $this->assign('page_description', SITE_DESCRIPTION);
        $this->assign('page_keywords', SITE_KEYWORDS);	
		
        $this->assign('site_url',SITE_URL);
		
        $this->assign('web_view_dir',SITE_URL.'/admin/view/default/');		
		
        $this->display('upfile.view.php');
    }

	

    function cagryadd()
    {
		$GLOBALS['Lang']->_get_lang('subject');	
	    $category = & $GLOBALS['SCup']->_get_category();
		 		 		
		$catgydata = $category->show($this->type);
		
		$catgystr = $category->html_format_category($catgydata,0);	

        $this->assign('catgystr', $catgystr);	
        $this->assign('modulename', '专题分类');	
        $this->assign('viewdata', array());				
        $this->assign('category_value', $this->type);
        $this->assign('appname', $this->type);			    
        $this->assign('view_charset', VIEW_CHARSET);	
        $this->assign('page_title', $GLOBALS['Lang']->_get_lang_var(SITE_TITLE));
        $this->assign('page_description', $GLOBALS['Lang']->_get_lang_var(SITE_DESCRIPTION));
        $this->assign('page_keywords', $GLOBALS['Lang']->_get_lang_var(SITE_KEYWORDS));	
		
        $this->assign('site_url',SITE_URL);
		
        $this->assign('web_view_dir',SITE_URL.'/admin/view/default/');		
		
        $this->display('cagryadd.view.php');
    }
	
    function editcatgy()
    {
		$GLOBALS['Lang']->_get_lang('subject');
		$id= intval($_GET['id']);
		
	    $category = & $GLOBALS['SCup']->_get_category();
		 		 		
		$catgydata = $category->show($this->type);
		
		$data = $category->oneshow($id);
		
		$catgystr = $category->html_format_category($catgydata,$data['parent_id'],0,0,$id);	
        $this->assign('appname', $this->type);
        $this->assign('data', $data);
        $this->assign('modulename', '专题分类');	
        $this->assign('viewdata', array());			
        $this->assign('catgystr', $catgystr);
		
        $this->assign('category_value', $this->type);
			    
        $this->assign('view_charset', VIEW_CHARSET);	
        $this->assign('page_title', $GLOBALS['Lang']->_get_lang_var(SITE_TITLE));
        $this->assign('page_description', $GLOBALS['Lang']->_get_lang_var(SITE_DESCRIPTION));
        $this->assign('page_keywords', $GLOBALS['Lang']->_get_lang_var(SITE_KEYWORDS));	
		
        $this->assign('site_url',SITE_URL);
		
        $this->assign('web_view_dir',SITE_URL.'/admin/view/default/');		
		
        $this->display('cagryedit.view.php');
    }
	
    function cagrylist()
    {
		$GLOBALS['Lang']->_get_lang('subject');		
	    $category = & $GLOBALS['SCup']->_get_category();
		 		 		
		$catgydata = $category->show($this->type);
		$catgydata = $category->get_list_category($catgydata);
        $this->assign('modulename', '专题分类');		
        $this->assign('appname', $this->type);		
        $this->assign('catgydata', $catgydata);				
        $this->assign('category_value', $this->type);
	    
        $this->assign('view_charset', VIEW_CHARSET);	
        $this->assign('page_title', $GLOBALS['Lang']->_get_lang_var(SITE_TITLE));
        $this->assign('page_description', $GLOBALS['Lang']->_get_lang_var(SITE_DESCRIPTION));
        $this->assign('page_keywords', $GLOBALS['Lang']->_get_lang_var(SITE_KEYWORDS));	
		
        $this->assign('site_url',SITE_URL);
		
        $this->assign('web_view_dir',SITE_URL.'/admin/view/default/');		
		
        $this->display('cagrylist.view.php');
    }

    function cyaddpost()
    {

	     $data = $_POST['data'];
         
		 $category = & $GLOBALS['SCup']->_get_category();
		 		 		
		 $category->post($data);
		 
		 $category->write_cache($this->type);	
		 	 		 
		 $this->cagrylist();

    }


    function cyeditpost()
    {

	     $id = $_POST['id'];

	     $data = $_POST['data'];
         
		 $category = & $GLOBALS['SCup']->_get_category();
		 		 		
		 $category->editaction($id,$data);

		 $category->write_cache($this->type);	
		 	 		 
		 $this->cagrylist();

    }

    function delcatgy()
    {
		$id= intval($_GET['id']);		

	    $category = & $GLOBALS['SCup']->_get_category();		 		 		
		$category->del($id);
		
		$category->write_cache($this->type);
				      
		$this->cagrylist();   
    }	
		



  
}

?>